#include <iostream>
using namespace std;

class Base
{

public:
	int bar(char x)
	{
		return (int)(x);
	}
	virtual int bar(int x)
	{
		return (2*x);
	}

};

class derived:public Base
{
public:
	int bar(char x)
	{
		return (int)(-x);
	}
	int bar(int x)
	{
		return (x/2);
	}
};


int main()
{
	//derived obj;
	//Base *pobj=&obj;
	//cout<<pobj->bar((char)(100))<<endl;
	//cout<<pobj->bar(100)<<endl;

		int n, m, i, s = 0;
		printf ("N M = ");
		scanf("%d%d", &n, &m);
		for (i = 2; i <= n; i++)
		{
			s = (s + m) % i;
			printf ("\nThe winner is %d\n", s+1);
		}
		
	
	return 0;
}